package com.social.controller;

import com.social.pojo.Notice;
import com.social.pojo.Result;
import com.social.service.NoticeService;
import io.swagger.annotations.Api;
import org.aspectj.weaver.ast.Not;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @className: NoticeController
 * @description: TODO 类描述
 * @author: XiaoXu
 * @date: 2023/01/09 19:04
 **/
@Api(tags = "NoticeController")
@RestController
@RequestMapping("/notice")
public class NoticeController {

    @Resource
    private NoticeService noticeService;

    @PostMapping
    public Result insert(@RequestBody Notice notice){
        return noticeService.insert(notice);
    }

    @GetMapping("/{id}")
    public Result getNoticeById(@PathVariable("id") Long id){
        return noticeService.getNoticeById(id);
    }

    @PutMapping
    public Result modify(@RequestBody Notice notice){
        return noticeService.modify(notice);
    }

    @GetMapping("/list")
    public Result getNoticeList(@RequestParam Long size,@RequestParam Long index){
        return noticeService.getNoticeList(size,index);
    }
}
